import React, { Component } from 'react';
import {Input, Button } from 'antd';

export default class Home extends Component {
  constructor(props) {
    super(props);
    this.state = {
      inputValue: 'hi, nice to meet you',
    };
  }

  render() {
    let inputProps = {
      placeholder: 'Basic usage',
      value: this.state.inputValue,
      // defaultValue: 'hi, nice to meet you',
      onChange: e => this.setState({ inputValue: e.target.value }),
      style: {
        width: 500,
      },
    };
    return (
      <div>
        <Input {...inputProps} />
        <span>inputValue:[{this.state.inputValue}]</span>
        <Button onClick={e => this.setState({ inputValue: 'hi, nice to meet you' })}>
          重置inputValue值
        </Button>
      </div>
    );
  }
}
